package com.itheima.common;
/**
 * 基于ThreadLocal封装工具类，用于保存和获取当前登录用户id
 */
public class BaseContext {
    //因为现在要获取的是id值 所以设定类型是Long
    private static ThreadLocal<Long>threadLoccal = new ThreadLocal<>();
    /**
     * 设置值
     * @param id
     */
    public static void setCurrentId(Long id){
        threadLoccal.set(id);
    }
    /**
     * 获取值
     * @return
     */
    public static Long getCurrentId(){
        return threadLoccal.get();
    }
}
